# vim:set ft=make:

OBJECTS_LIBUART         += uart_imx.o uart_pl011.o
OBJECTS_LIBUART         += $(if $(CONFIG_PF_IMX_8XQ),uart_lpuart.o)
OBJECTS_LIBUART         += $(if $(CONFIG_PF_IMX_95),uart_lpuart.o)
PREPROCESS_PARTS	+= $(if $(CONFIG_PF_IMX_21),kern_start_0xd)
PREPROCESS_PARTS        += $(if $(CONFIG_PF_IMX_35),imx_epit)
PREPROCESS_PARTS	+= $(if $(CONFIG_PF_IMX_51),imx_epit \
                                                    pic_gic pic_gic_mxc_tzic)
PREPROCESS_PARTS	+= $(if $(CONFIG_PF_IMX_53),imx_epit \
                                                    pic_gic pic_gic_mxc_tzic)
PREPROCESS_PARTS        += $(if $(CONFIG_PF_IMX_6),pic_gic)
PREPROCESS_PARTS        += $(if $(CONFIG_PF_IMX_6_TIMER_MPTIMER),mptimer)
PREPROCESS_PARTS        += $(if $(CONFIG_PF_IMX_6_TIMER_EPIT),imx_epit)
PREPROCESS_PARTS        += $(if $(CONFIG_PF_IMX_6UL),pic_gic \
                                                     arm_generic_timer)
PREPROCESS_PARTS        += $(if $(CONFIG_PF_IMX_7),pic_gic \
                                                   arm_generic_timer)
PREPROCESS_PARTS        += $(if $(CONFIG_ARM_V8),pic_gic \
                                                 arm_generic_timer)
RAM_PHYS_BASE           := $(CONFIG_PF_IMX_RAM_PHYS_BASE)

INTERFACES_KERNEL     += $(if $(CONFIG_PF_IMX_6UL),generic_timer)
INTERFACES_KERNEL     += $(if $(CONFIG_PF_IMX_7),generic_timer)
INTERFACES_KERNEL     += $(if $(CONFIG_ARM_V8),generic_timer)
INTERFACES_KERNEL-$(CONFIG_PF_IMX_35) += timer_imx_epit
INTERFACES_KERNEL-$(CONFIG_PF_IMX_51) += timer_imx_epit
INTERFACES_KERNEL-$(CONFIG_PF_IMX_53) += timer_imx_epit
INTERFACES_KERNEL-$(CONFIG_PF_IMX_6_TIMER_EPIT) += timer_imx_epit

MPCORE_PHYS_BASE      := 0x00a00000

LIBUART_HDR-$(CONFIG_PF_IMX_21)    += uart_imx.h
LIBUART_TYP-$(CONFIG_PF_IMX_21)    += L4::Uart_imx21
LIBUART_HDR-$(CONFIG_PF_IMX_28)    += uart_pl011.h
LIBUART_TYP-$(CONFIG_PF_IMX_28)    += L4::Uart_pl011
LIBUART_HDR-$(CONFIG_PF_IMX_35)    += uart_imx.h
LIBUART_TYP-$(CONFIG_PF_IMX_35)    += L4::Uart_imx35
LIBUART_HDR-$(CONFIG_PF_IMX_51)    += uart_imx.h
LIBUART_TYP-$(CONFIG_PF_IMX_51)    += L4::Uart_imx51
LIBUART_HDR-$(CONFIG_PF_IMX_53)    += uart_imx.h
LIBUART_TYP-$(CONFIG_PF_IMX_53)    += L4::Uart_imx51
LIBUART_HDR-$(CONFIG_PF_IMX_6)     += uart_imx.h
LIBUART_TYP-$(CONFIG_PF_IMX_6)     += L4::Uart_imx6
LIBUART_HDR-$(CONFIG_PF_IMX_6UL)   += uart_imx.h
LIBUART_TYP-$(CONFIG_PF_IMX_6UL)   += L4::Uart_imx6
LIBUART_HDR-$(CONFIG_PF_IMX_7)     += uart_imx.h
LIBUART_TYP-$(CONFIG_PF_IMX_7)     += L4::Uart_imx7
LIBUART_HDR-$(CONFIG_PF_IMX_8XQ)   += uart_lpuart.h
LIBUART_TYP-$(CONFIG_PF_IMX_8XQ)   += L4::Uart_lpuart
LIBUART_HDR-$(CONFIG_PF_IMX_8M)    += uart_imx.h
LIBUART_TYP-$(CONFIG_PF_IMX_8M)    += L4::Uart_imx8
LIBUART_HDR-$(CONFIG_PF_IMX_8MP)   += uart_imx.h
LIBUART_TYP-$(CONFIG_PF_IMX_8MP)   += L4::Uart_imx8
LIBUART_HDR-$(CONFIG_PF_IMX_95)    += uart_lpuart.h
LIBUART_TYP-$(CONFIG_PF_IMX_95)    += L4::Uart_lpuart

CXXFLAGS_uart-libuart += -include $(LIBUART_HDR-y) -DFIASCO_UART_TYPE=$(LIBUART_TYP-y)


config_IMPL           += config-arm-imx
mem_layout_IMPL       += mem_layout-arm-imx
pic_IMPL              += $(if $(CONFIG_PF_IMX_21),pic-arm-imx)
pic_IMPL              += $(if $(CONFIG_PF_IMX_28),pic-arm-imx-icoll)
pic_IMPL              += $(if $(CONFIG_PF_IMX_35),pic-arm-imx)
pic_IMPL              += $(if $(CONFIG_PF_IMX_51),pic-gic pic-arm-imx-gic)
pic_IMPL              += $(if $(CONFIG_PF_IMX_53),pic-gic pic-arm-imx-gic)
pic_IMPL              += $(if $(CONFIG_PF_IMX_6),pic-gic pic-arm-imx-gic)
pic_IMPL              += $(if $(CONFIG_PF_IMX_6UL),pic-gic pic-arm-imx-gic)
pic_IMPL              += $(if $(CONFIG_PF_IMX_7),pic-gic pic-arm-imx-gic)
pic_IMPL              += $(if $(CONFIG_ARM_V8),pic-gic pic-arm-imx-gic)
timer_IMPL            += $(if $(CONFIG_PF_IMX_21),timer-arm-imx21)
timer_IMPL            += $(if $(CONFIG_PF_IMX_28),timer-arm-timrot)
timer_IMPL            += $(if $(CONFIG_PF_IMX_35),timer-arm-imx_epit)
timer_IMPL            += $(if $(CONFIG_PF_IMX_51),timer-arm-imx_epit)
timer_IMPL            += $(if $(CONFIG_PF_IMX_53),timer-arm-imx_epit)
timer_IMPL            += $(if $(CONFIG_PF_IMX_6_TIMER_MPTIMER),timer-arm-mptimer timer-arm-mptimer-imx6)
timer_IMPL            += $(if $(CONFIG_PF_IMX_6_TIMER_EPIT),timer-arm-imx_epit)
timer_IMPL            += $(if $(CONFIG_PF_IMX_6UL),timer-arm-generic timer-arm-generic-imx)
timer_IMPL            += $(if $(CONFIG_PF_IMX_7),timer-arm-generic timer-arm-generic-imx)
timer_IMPL            += $(if $(CONFIG_ARM_V8),timer-arm-generic timer-arm-generic-imx)
timer_tick_IMPL       += $(if $(and $(CONFIG_PF_IMX_6_TIMER_EPIT),$(CONFIG_MP)),\
			   timer_tick-broadcast,timer_tick-single-vector)
reset_IMPL            += reset-arm-imx
outer_cache_IMPL      += outer_cache-arm-imx6
clock_IMPL            += $(if $(CONFIG_PF_IMX_6UL)$(CONFIG_PF_IMX_7)$(CONFIG_ARM_V8),\
			   clock-arm-generic,clock-generic)
platform_control_IMPL += platform_control-arm-imx
iommu_IMPL            += $(if $(CONFIG_IOMMU_ARM_SMMU_500),iommu-arm-smmu-500-imx)
iommu_IMPL            += $(if $(CONFIG_IOMMU_ARM_SMMU_V3),iommu-arm-smmu-v3-imx)
